package com.zjxh.zjxh.mob.controller;

import com.zjxh.zjxh.common.Result;
import com.zjxh.zjxh.common.aop.ApiLog;
import com.zjxh.zjxh.common.req.IdReq;
import com.zjxh.zjxh.common.req.PageKeywordReq;
import com.zjxh.zjxh.common.util.NPage;
import com.zjxh.zjxh.mob.service.ApplicationClaimService;
import com.zjxh.zjxh.mob.vo.req.ClaimInsertReq;
import com.zjxh.zjxh.mob.vo.req.EvaluateReq;
import com.zjxh.zjxh.mob.vo.resp.ExpertInfoResp;
import com.zjxh.zjxh.mob.vo.resp.ExpertListResp;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import javax.servlet.http.HttpServletRequest;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author: oyp
 * @date: 2024/5/28 on 16:05
 * @desc: 申请诉求-页面
 */
@Api(tags = "群众端-申请诉求页面")
@RestController
@RequestMapping("/mob-apply-claim")
public class ApplicationClaimController {

  private final ApplicationClaimService applicationClaimService;

  public ApplicationClaimController(ApplicationClaimService applicationClaimService) {
    this.applicationClaimService = applicationClaimService;
  }

  @ApiLog("专家列表")
  @ApiOperation("专家列表")
  @GetMapping("expert-list")
  public Result<NPage<ExpertListResp>> expertList(
      HttpServletRequest request, @Validated @ModelAttribute PageKeywordReq req) {
    return applicationClaimService.expertList(request, req);
  }

  @ApiLog("专家详情")
  @ApiOperation("专家详情")
  @GetMapping("expert-info")
  public Result<ExpertInfoResp> expertInfo(
      HttpServletRequest request, @Validated @ModelAttribute IdReq req) {
    return applicationClaimService.expertInfo(request, req);
  }

  @ApiLog("添加诉求")
  @ApiOperation("添加诉求")
  @PostMapping("insert-claim")
  public Result<Object> insetClaim(
      HttpServletRequest request, @Validated @RequestBody ClaimInsertReq req) {
    return applicationClaimService.insetClaim(request, req);
  }

  @ApiLog("添加评价")
  @ApiOperation("添加评价")
  @PostMapping("insert-evaluate")
  public Result<Object> insetEvaluate(
      HttpServletRequest request, @Validated @RequestBody EvaluateReq req) {
    return applicationClaimService.insetEvaluate(request, req);
  }
}
